<?php
namespace app\api\validate\user;
use think\Validate;
class UserValidate extends Validate
{
    protected $rule = [
        'mobile' => ['require', 'regex' => '/^1[3-9][\d]{9}/'],
        'password' => 'require|min:6',
        'code' => 'require',
    ];
    protected $message = [
        'mobile.require' => '手机号不能为空',
        'mobile.regex' => '手机号格式错误',
        'password.require' => '密码不能为空',
        'password.min' => '密码不能少于6位',
        'code.require' => '验证码不能为空',
    ];
    protected $scene = [
        'reg' => ['mobile', 'password'],
        'login' => ['mobile', 'password']
    ];
}